const api = {
	list: '/front/mall/shopping-cart/getShopCart',
	add: '/front/mall/shopping-cart/addShoppingCart',
	update: '/front/mall/shopping-cart/updateShoppingCartQuantity',
	deleteAll: '/front/mall/shopping-cart/deleteAllByWxUserId',
	deleteSome: '/front/mall/shopping-cart/deleteSomeByWxUserIdAndProductDetailIds',
	deleteOne: '/front/mall/shopping-cart/deleteByWxUserIdAndProductDetailId',
	getProDetail: '/front/mall/shopping-cart/getProductDetail'

}

// 购物车列表
export const list = () => {
	return uni.$http.get(api.list);
}

// 添加商品到购物车
export const add = (productDetailId, shoppingCartQuantity) => {
	return uni.$http.post(api.add, {
		productDetailId,
		shoppingCartQuantity
	});
}

// 更新购物车商品数量
export const update = (productDetailId, shoppingCartQuantity) => {
	return uni.$http.post(api.update, {
		productDetailId,
		shoppingCartQuantity
	});
}

// 删除用户的所有购物车商品
export const deleteAll = () => {
	return uni.$http.get(api.deleteAll);
}

// 删除用户的部分购物车商品
export const deleteSome = (productDetailIds) => {
	return uni.$http.post(api.deleteSome, {
		productDetailIds
	});
}

// 删除用户的单个购物车商品
export const deleteOne = (productDetailId) => {
	return uni.$http.get(api.deleteOne, {
		productDetailId
	});
}

// 获取商品详情
export const getProDetail = (productId) => {
	return uni.$http.get(api.getProDetail, {
		productId
	});
}